﻿using WeifenLuo.WinFormsUI.Docking;

namespace LD.Host
{
    public partial class BaseFrm : DockContent
    {
        public BaseFrm()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 检查权限
        /// </summary>
        /// <param name="userType">允许的权限等级</param>
        public void Permission(UserType userType)
        {
            //Dialog dialog = new Dialog();
            string className = this.GetType().Name;
            switch (userType)
            {
                case UserType.管理员:
                    if (Appbus.User.CurrentUser.Name != userType.ToString())
                    {
                        this.Close();
                        //dialog.Warning("权限限制");
                    }
                    break;
                case UserType.工程师:
                    if (Appbus.User.CurrentUser.Name == UserType.操作工.ToString())
                    {
                        this.Close();
                        //dialog.Warning("权限限制");
                    }
                    break;
                case UserType.操作工:
                    break;
                default:
                    break;
            }
        }
    }
}
